home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Singles Flirt Up Your Life! (German)
/
Singles Flirt Up Your Life.iso
/
data1.cab
/
Statemachine
/
subwalk.lua
< prev
next >
Wrap
Text File
|
2004-01-29
|
3KB
|
150 lines
-- subwalk state machine
beginStateMachine()
onEnter(function(msg)
print("subwalk onEnter ---------------");
end )
onExit(function(msg)
print("subwalk onExit ----------------");
end )
-- stand
state("stand")
onEnter(function(msg)
-- mission test
getParent().getGameObjectServer().mission.sendMsgThis("checkComplete");
setPose(archize(getParent(), "stand1"));
end )
onMsg("end", function(msg)
setDelayedState("stand2", random(1000, 3000));
actionComplete();
end )
state("stand2")
onEnter(function(msg)
setPose(archize(getParent(), "stand2"));
end )
onMsg("end", function(msg)
setDelayedState("stand3", random(1000, 3000));
actionComplete();
end )
state("stand3")
onEnter(function(msg)
setPose(archize(getParent(), "stand3"));
end )
onMsg("end", function(msg)
setDelayedState("stand4", random(1000, 3000));
actionComplete();
end )
state("stand4")
onEnter(function(msg)
setPose(archize(getParent(), "stand4"));
end )
onMsg("end", function(msg)
setDelayedState("stand", random(1000, 3000));
actionComplete();
end )
-- walk
state("walk")
onEnter(function(msg)
-- if distance to walk is greater 4m, run
if isRunDistance() then
setState("runRFF-runLFF");
else
local c = getParent();
startWalk(archizeWalk(c, "stand-walkLFF-"), archizeWalk(c, "stand-walkLFF-"), WALK_SPEEDUP);
end
end )
onMsg("next", function(msg)
setState("walkLFF-walkRFF");
end )
onMsg("end", function(msg)
exitStateMachine();
end )
state("walkRFF-walkLFF")
onEnter(function(msg)
if isRunDistance() then
setState("runRFF-runLFF");
else
local c = getParent();
startWalk(archizeWalk(c, "walkRFF-walkLFF-"), archizeWalk(c, "walkRFF-stand-"), WALK_SPEEDUP);
createDirt(DIRT_FOOTSTEP, WALK_DIRT_SIZE, WALK_DIRT_PROBABILITY);
makeStepSound();
end
end )
onMsg("next", function(msg)
setState("walkLFF-walkRFF");
end )
onMsg("end", function(msg)
exitStateMachine();
end )
state("walkLFF-walkRFF")
onEnter(function(msg)
local c = getParent();
startWalk(archizeWalk(c, "walkLFF-walkRFF-"), archizeWalk(c, "walkLFF-stand-"), WALK_SPEEDUP);
makeStepSound();
end )
onMsg("next", function(msg)
setState("walkRFF-walkLFF");
end )
onMsg("end", function(msg)
exitStateMachine();
end )
-- run
state("runRFF-runLFF")
onEnter(function(msg)
local c = getParent();
startWalk(archizeWalk(c, "runRFF-runLFF-"), archizeWalk(c, "walkRFF-stand-"), RUN_SPEEDUP);
createDirt(DIRT_FOOTSTEP, WALK_DIRT_SIZE, WALK_DIRT_PROBABILITY);
makeStepSound();
end )
onMsg("next", function(msg)
setState("runLFF-runRFF");
end )
onMsg("end", function(msg)
exitStateMachine();
end )
state("runLFF-runRFF")
onEnter(function(msg)
local c = getParent();
startWalk(archizeWalk(c, "runLFF-runRFF-"), archizeWalk(c, "walkLFF-stand-"), RUN_SPEEDUP);
createDirt(DIRT_FOOTSTEP, WALK_DIRT_SIZE, WALK_DIRT_PROBABILITY);
makeStepSound();
end )
onMsg("next", function(msg)
setState("runRFF-runLFF");
end )
onMsg("end", function(msg)
exitStateMachine();
end )
endStateMachine()